﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Sispe.Entities;
using Sispe.BussinesLogic;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;

namespace Sispe.Mvc4.Controllers
{
    public class VacacionesController : Controller
    {
        [Dependency]
        public IVacacionesBL vacacionBL { get; set; }

        [Dependency]
        public IContratoBL contratoBL { get; set; }

        public ActionResult Index(int id = 0)
        {
            if (id == 0)
            {
                return RedirectToAction("Index", "Contrato");
            }
            else
            {
                //var sanciones = (from c in vacacionBL.GetAllFromVacaciones()
                //                 where c.IdContrato.Equals(id)
                //                 select c).ToList();

                var contrato = contratoBL.GetFromContratoById(id);

                if (contrato == null)
                {
                    return RedirectToAction("Index", "Contrato");
                }

                ViewData["IdContrato"] = contrato.IdContrato;
                ViewData["TRABAJADOR"] = contrato.TRABAJADOR.PERSONA.NombreCompleto;

                return View();
            }
        }

    }
}
